<ion-view view-title="{{title+title2}}" class="myagent_add">
	<ion-nav-bar ng-class="baseclass">
		<ion-nav-back-button></ion-nav-back-button>
		<ion-nav-buttons side="right">
			<button class="button button-clear saveText" on-tap="submit()">保存</button>
		</ion-nav-buttons>
	</ion-nav-bar>
	
	<ion-content class="bg">
		<!--<ion-scroll direction="y" ng-style="myObj">-->
		<div class="list">
			<li class="item regionItem">
				<div class="row">
					<div class="nameCol">
						{{title2}}
					</div>
					<div class="col catTip" on-tap="openAgentModal()">
						{{agentName||'请选择'}}<img class="jt" src="./img/guilin/common/icon_right@2x.png" ng-class="{'invisible':input.id}"/>
					</div>
				</div>
			</li>
			
			<li class="item regionItem">
				<div class="row">
					<div class="nameCol">
						授权额度
					</div>
					<div class="col catTip">
						<input type="number"  placeholder="请输入授信额度" ng-model="input.credit_line" />
					</div>
					<div>元</div>
				</div>
			</li>
			
			<li class="item regionItem">
				<div class="row">
					<div class="nameCol">
						区域
					</div>
					<div class="col catTip" on-tap="showSelectRegion()">
						请添加<img class="jt" src="{{isShowSelectRegion?'./img/guilin/common/icon_up@2x.png':'./img/guilin/common/icon_down@2x.png'}}" />
					</div>
				</div>
			</li>
			<!--地区。显示/隐藏-->
			<div ng-if="isShowSelectRegion">
				<li class="item regionItem">
					<div class="row">
						<div class="nameCol">
							&nbsp;
						</div>
						<div class="col catTip">
							<div class="item-input item-select" data-tap-disabled="true" style="padding:0 30px 0 15px;height: 44px;line-height: 44px;">
									<div class="input-value" ng-click="doSelectProvince()">{{input.province.name}}</div>
							</div>
						</div>
					</div>
				</li>
				<li class="item regionItem">
					<div class="row">
						<div class="nameCol hideLine">
							&nbsp;
						</div>
						<div class="col catTip">
							<div class="item-input item-select" data-tap-disabled="true" style="padding:0 30px 0 15px;height: 44px;line-height: 44px;">
									<div class="input-value" ng-click="doSelectCity()">{{input.city.name}}</div>
							</div>
						</div>
					</div>
				</li>
				<li class="item regionItem">
					<div class="row">
						<div class="nameCol hideLine">
							&nbsp;
						</div>
						<div class="col catTip">
							<div class="item-input item-select" data-tap-disabled="true" style="padding:0 30px 0 15px;height: 44px;line-height: 44px;">
									<div class="input-value" ng-click="doSelectDistrict()">{{input.district.name}}</div>
							</div>
						</div>
					</div>
				</li>
				<!--按钮-->
				<li class="item regionItem">
					<div class="row">
						<div class="nameCol hideLine">
							&nbsp;
						</div>
						<div class="col">
							<span class="baseBtn blue" on-tap="add_region()">确定</span>
							<span class="baseBtn grab right-zhang" on-tap="showSelectRegion()">取消</span>
						</div>
					</div>
				</li>
			</div>
			<li class="item selectedItem" ng-if="regions.length>0"><!--显示 。保存过的品牌，品类、区域只能增加，不能删除-->
				<p ng-repeat="region in regions track by $index">
					{{region}}<img class="delIcon" src="./img/guilin/common/icon_delete_g@2x.png" ng-if="!input.id||$index>=scope[0].region.length" on-tap="delete_region($index)"/>
				</p>
			</li>
			
			
			<!--品牌块-->
			<div class="brandDiv" ng-repeat="obj in brandArrShow" on-tap="getBrandArrIndex($index)">
				<img src="./img/guilin/common/icon_delete_g@2x.png" class="delBrand" on-tap="delBrandDiv($index)" ng-if="$index>0&&(!input.id||$index>=scope.length)"/>
				<li class="item regionItem">
					<div class="row">
						<div class="nameCol">
							品牌
						</div>
						<div class="col catTip" on-tap="openbrandOrderBy($index)">
							{{obj.brand.name||'请选择'}}<img class="jt" src="./img/guilin/common/icon_right@2x.png" ng-if="!input.id||$index>=scope.length"/>
						</div>
					</div>
				</li>
				<li class="item regionItem">
					<div class="row">
						<div class="nameCol">
							产品分类
						</div>
						<div class="col catTip" on-tap="showSelectCat($index)">
							请添加<img class="jt" src="{{obj.isShowSelectCat?'./img/guilin/common/icon_up@2x.png':'./img/guilin/common/icon_down@2x.png'}}" />
						</div>
					</div>
				</li>
				<div ng-if="obj.isShowSelectCat"><!--分类。显示/隐藏-->
					<li class="item regionItem">
						<div class="row">
							<div class="nameCol">
								&nbsp;
							</div>
							<div class="col catTip">
									<div class="item-input item-select" data-tap-disabled="true" style="padding:0 30px 0 15px;height: 44px;line-height: 44px;">
											<div class="input-value" ng-click="doSelectCat1()">{{input.cat1.name}}</div>
									</div>
							</div>
						</div>
					</li>
					<li class="item regionItem">
						<div class="row">
							<div class="nameCol hideLine">
								&nbsp;
							</div>
							<div class="col catTip">
									<div class="item-input item-select" data-tap-disabled="true" style="padding:0 30px 0 15px;height: 44px;line-height: 44px;">
											<div class="input-value" ng-click="doSelectCat2()">{{input.cat2.name}}</div>
									</div>
							</div>
						</div>
					</li>
					<li class="item regionItem">
						<div class="row">
							<div class="nameCol hideLine">
								&nbsp;
							</div>
							<div class="col catTip">
									<div class="item-input item-select" data-tap-disabled="true" style="padding:0 30px 0 15px;height: 44px;line-height: 44px;">
											<div class="input-value" ng-click="doSelectCat3()">{{input.cat3.name}}</div>
									</div>
							</div>
						</div>
					</li>
					<!--按钮-->
					<li class="item regionItem">
						<div class="row">
							<div class="nameCol hideLine">
								&nbsp;
							</div>
							<div class="col">
								<span class="baseBtn blue" on-tap="add_type()">确定</span>
								<span class="baseBtn grab right-zhang" on-tap="showSelectCat($index)">取消</span>
							</div>
						</div>
					</li>
				</div>
				<li class="item selectedItem" ng-if="obj.cats.length>0"><!--显示 -->
					<p ng-repeat="cat in obj.cats">
						{{cat}}<img class="delIcon" src="./img/guilin/common/icon_delete_g@2x.png" ng-show="!input.id||$index>=scope[$parent.$index].cat_type.length" on-tap="delete_cat($parent.$index,$index)"/>
					</p>
				</li>
				<li class="item regionItem">
					<div class="row">
						<div class="nameCol">
							能否改价：
						</div>
						<div class="col catTip">
							<label class="toggle toggleGreen">
					            <input type="checkbox" ng-model="obj.is_price">
					            <div class="track">
					               <div class="handle"></div>
					            </div>
				            </label>
						</div>
					</div>
				</li>
			</div>
		</div>
		<!--</ion-scroll>-->
	</ion-content>
	
	<div class="addBtn" on-tap="addBrandDiv()">添加品牌</div>
</ion-view>